const App = {
    mixins: [Save],//配置文件，路径/utils/mixins.js
    data() {
        return {
            Subsidy_Amount:0,
            Subsidy_Amount1:0,
            dataForm:{
                Application_Amount:0,
            }
        };
    },
    mounted() {
        this.dataForm.Application_SerialNumber = this.nodeKey;
        let ls_URL = window.location.href;
        this.Subsidy_Amount = getQueryObject(ls_URL, "Subsidy_Amount");// 获取 nodeKey 参数
        this.Subsidy_Amount1 = getQueryObject(ls_URL, "Subsidy_Amount1");// 获取 nodeKey 参数
    },
    methods: {
        async handleSubmit() {
            const allValid = await this.validateAllForms();
            if (this.dataForm.Application_Amount == 0) {
                this.$message({
                    type:'warning',
                    message:'发放金额不能为0'
                })
                return
            }
            if (allValid) {
                this.loading = true;
                $.ajax({
                    headers: requestHeaders(),
                    url: `${mh}/generalBusiness/generalQueryByTableNameWithOriginal`,
                    method: "post",
                    data: {
                        Data: 'subsidy_application',
                        Condition: `subsidy_application.Application_SerialNumber='${this.nodeKey}'`,
                    },
                    success: (data) => {
                        data[0].Subsidy_Amount = accAdd(data[0].Subsidy_Amount, this.dataForm.Application_Amount);
                        let lJSONObject_DataSet = {
                            Modify:{
                                subsidy_application:data
                            },
                            Add:{
                                subsidy_application_distribution: [this.dataForm]
                            }
                        }
                        let Operation_Main = JSON.stringify(deepClone(lJSONObject_DataSet));
                        lJSONObject_DataSet['Add']['base_operation_log'] = [{
                            Operation_Type: '0',
                            Operation_Path: this.relativePath,
                            Operation_Main,
                            Operation_Interface: "generalSaveByRequestBody",
                            Operation_IP: getIpAddress()
                        }]
                        submitSave(lJSONObject_DataSet, (res) => {
                            if (res.Status == 'success') {
                                window.history.go(-1)
                            }
                            this.loading = false;
                        })
                    },
                    complete: (XMLHttpRequest) => {
                        requestPretreatment(XMLHttpRequest)
                    },
                });
            } else {
                this.$message({
                    message: '存在未填写的必填项！',
                    type: 'warning'
                });
            }
        },
    },
};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus, { locale: zhCn });
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
app.component('yl-upload', ylUpload);
app.component('yl-text-editor', ylTextEditor);
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
